import request from '@/utils/request'

export function getList(current,size) {
  return request({
    url: `/cmdb-middleware/page/${current}/${size}`,
    method: 'get'
  })
}
export function doAdd(data){
    return request({
        url: '/cmdb-middleware/',
        method: 'post',
        data
    })
}
export function doEdit(data) {
  return request({
    url: '/cmdb-middleware/',
    method: 'put',
    data
  })
}
export function doDelete(id) {
  return request({
    url: `/cmdb-middleware/${id}`,
    method: 'delete'
  })
}
export function batchDelete(list) {
  let apiUrl = '/cmdb-middleware/removeByIds?'
  let parame = '';
  for(let i = 0; i < list.length; i++){
    parame = parame +'ids='+list[i]+'&';
  }
  parame = parame.substr(0, parame.length - 1);  
  apiUrl = apiUrl + parame;
  return request({
    url: apiUrl,
    method: 'delete'
  })
}
export function getOne(id) {
  return request({
    url: `/cmdb-middleware/${id}`,
    method: 'get'
  })
}
export function getAll() {
  return request({
    url: `/cmdb-middleware/`,
    method: 'get'
  })
}
export function search(data) {
  return request({
    url: '/cmdb-middleware/pageCondition/?name='+data,
    method: 'get'
  })
}